import request from "../../utils/request";


// 请求上首页数据

const getHomeData = ()=>{
    return request.get('api/index')
}

// 获取首页热销商品
const getHomeAllData = (index,page)=>{
    if(index === 0){
        return request.get('api/index',{params:{sales:1,page:page}})
    }else if(index === 1){
        return request.get('api/index',{params:{recommend:1,page:page}})
    }else {
        return request.get('api/index',{params:{new:1,page:page}})
    }
}
// //获取首页新书数据
//
// const getHomeNewData = ()=>{
//     return request.get('api/index',{params:{new:1}})
// }
// //获取首页推荐数据
//
// const getHomeRecommendData = ()=>{
//     return request.get('api/index',{params:{recommend:1}})
// }

// 商品收藏、

const collectGoods = (goods)=>{
    return request.post(`/api/collects/goods/${goods}`)
}

export {
    getHomeData,
    getHomeAllData,
    collectGoods
    // getHomeNewData,
    // getHomeRecommendData
}